home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 5 / BBS in a Box -Volume V (BBS in a Box) (April 1992).iso / Files / Prog / T / Think-Pascal-7.0.cpt / THINK Pascal Interfaces / PPCToolBox.p < prev    next >
Encoding:
Text File  |  1991-04-05  |  10.5 KB  |  426 lines  |  [TEXT/PJMM]

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2.  
  3. {}
  4. {Created: Sunday, January 6, 1991 at 10:55 PM}
  5. {    PPCToolBox.p}
  6. {    Pascal Interface to the Macintosh Libraries}
  7. {}
  8. {        Copyright Apple Computer, Inc.    1989-1990}
  9. {        All rights reserved}
  10. {}
  11.  
  12.  
  13. {$IFC UNDEFINED UsingIncludes}
  14. {$SETC UsingIncludes := 0}
  15. {$ENDC}
  16.  
  17.  
  18. unit PPCToolBox;
  19. interface
  20.     uses
  21.         Types, OSUtils, AppleTalk, Memory;
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.     type
  42.         PPCServiceType = SignedByte;
  43.  
  44.     const
  45.  
  46. {  service Type  }
  47.         ppcServiceRealTime = 1;
  48.  
  49.     type
  50.         PPCLocationKind = INTEGER;
  51.  
  52.     const
  53.  
  54. { lookup Type }
  55.         ppcNoLocation = 0;                          { There is no PPCLocName }
  56.         ppcNBPLocation = 1;                         { Use AppleTalk NBP      }
  57.         ppcNBPTypeLocation = 2;                     { Used for specifying a location name type during PPCOpen only }
  58.  
  59.     type
  60.         PPCPortKinds = INTEGER;
  61.  
  62.     const
  63.  
  64. { port Types }
  65.  
  66.         ppcByCreatorAndType = 1;                    { PortType is specified as colloquial Mac creator and type }
  67.         ppcByString = 2;                            { Port Type is in pascal string format }
  68.  
  69.     type
  70.         PPCSessionOrigin = SignedByte;              { Values returned for request field in PPCInform call }
  71.  
  72.     const
  73.  
  74. { Values returned for requestType field in PPCInform call }
  75.         ppcLocalOrigin = 1;                         { session originated from this machine }
  76.         ppcRemoteOrigin = 2;                        { session originated from remote machine }
  77.  
  78.     type
  79.         PPCPortRefNum = INTEGER;
  80.         PPCSessRefNum = LONGINT;
  81.  
  82.         PPCPortPtr = ^PPCPortRec;
  83.         PPCPortRec = record
  84.                 nameScript: ScriptCode;                 { script of name }
  85.                 name: Str32;                            { name of port as seen in browser }
  86.                 portKindSelector: PPCPortKinds;         { which variant }
  87.                 case PPCPortKinds of
  88.                     ppcByString: (
  89.                             portTypeStr: Str32
  90.                     );
  91.                     ppcByCreatorAndType: (
  92.                             portCreator: OSType;
  93.                             portType: OSType
  94.                     );
  95.             end;
  96.  
  97.         LocationNamePtr = ^LocationNameRec;
  98.         LocationNameRec = record
  99.                 locationKindSelector: PPCLocationKind;  { which variant }
  100.                 case PPCLocationKind of
  101.                     ppcNBPLocation: (
  102.                             nbpEntity: EntityName
  103.                     );            { NBP name entity }
  104.                     ppcNBPTypeLocation: (
  105.                             nbpType: Str32
  106.                     );                   { just the NBP type string, for PPCOpen }
  107.             end;
  108.  
  109.         PortInfoPtr = ^PortInfoRec;
  110.         PortInfoRec = record
  111.                 filler1: SignedByte;
  112.                 authRequired: BOOLEAN;
  113.                 name: PPCPortRec;
  114.             end;
  115.  
  116.  
  117.         PortInfoArrayPtr = ^PortInfoArray;
  118.         PortInfoArray = array[0..0] of PortInfoRec;
  119.         PPCFilterProcPtr = ProcPtr;
  120. {Procedures you will need to write }
  121. { ex: void MyCompletionRoutine(PPCParamBlkPtr pb) }
  122. { ex: pascal Boolean    MyPortFilter(LocationNamePtr locationName, PortInfoPtr }
  123. { thePortInfo)}
  124.  
  125.         PPCCompProcPtr = ProcPtr;
  126.  
  127.         PPCOpenPBPtr = ^PPCOpenPBRec;
  128.         PPCOpenPBRec = record
  129.                 qLink: Ptr;
  130.                 csCode: INTEGER;
  131.                 intUse: INTEGER;
  132.                 intUsePtr: Ptr;
  133.                 ioCompletion: PPCCompProcPtr;
  134.                 ioResult: OSErr;
  135.                 reserved: array[1..5] of LONGINT;      { reserved }
  136.                 portRefNum: PPCPortRefNum;              { Port Reference }
  137.                 filler1: LONGINT;
  138.                 serviceType: PPCServiceType;
  139.                 resFlag: SignedByte;
  140.                 portName: PPCPortPtr;                   { PortName for PPC }
  141.                 locationName: LocationNamePtr;
  142.                 networkVisible: BOOLEAN;
  143.                 nbpRegistered: BOOLEAN;
  144.             end;
  145.  
  146.         PPCInformPBPtr = ^PPCInformPBRec;
  147.         PPCInformPBRec = record
  148.                 qLink: Ptr;
  149.                 csCode: INTEGER;
  150.                 intUse: INTEGER;
  151.                 intUsePtr: Ptr;
  152.                 ioCompletion: PPCCompProcPtr;
  153.                 ioResult: OSErr;
  154.                 reserved: array[1..5] of LONGINT;
  155.                 portRefNum: PPCPortRefNum;
  156.                 sessRefNum: PPCSessRefNum;
  157.                 serviceType: PPCServiceType;
  158.                 autoAccept: BOOLEAN;
  159.                 portName: PPCPortPtr;
  160.                 locationName: LocationNamePtr;
  161.                 userName: StringPtr;
  162.                 userData: LONGINT;
  163.                 requestType: PPCSessionOrigin;
  164.             end;
  165.  
  166.         PPCStartPBPtr = ^PPCStartPBRec;
  167.         PPCStartPBRec = record
  168.                 qLink: Ptr;
  169.                 csCode: INTEGER;
  170.                 intUse: INTEGER;
  171.                 intUsePtr: Ptr;
  172.                 ioCompletion: PPCCompProcPtr;
  173.                 ioResult: OSErr;
  174.                 reserved: array[1..5] of LONGINT;
  175.                 portRefNum: PPCPortRefNum;
  176.                 sessRefNum: PPCSessRefNum;
  177.                 serviceType: PPCServiceType;
  178.                 resFlag: SignedByte;
  179.                 portName: PPCPortPtr;
  180.                 locationName: LocationNamePtr;
  181.                 rejectInfo: LONGINT;
  182.                 userData: LONGINT;
  183.                 userRefNum: LONGINT;
  184.             end;
  185.  
  186.         PPCAcceptPBPtr = ^PPCAcceptPBRec;
  187.         PPCAcceptPBRec = record
  188.                 qLink: Ptr;
  189.                 csCode: INTEGER;
  190.                 intUse: INTEGER;
  191.                 intUsePtr: Ptr;
  192.                 ioCompletion: PPCCompProcPtr;
  193.                 ioResult: OSErr;
  194.                 reserved: array[1..5] of LONGINT;
  195.                 filler1: INTEGER;
  196.                 sessRefNum: PPCSessRefNum;
  197.             end;
  198.  
  199.         PPCRejectPBPtr = ^PPCRejectPBRec;
  200.         PPCRejectPBRec = record
  201.                 qLink: Ptr;
  202.                 csCode: INTEGER;
  203.                 intUse: INTEGER;
  204.                 intUsePtr: Ptr;
  205.                 ioCompletion: PPCCompProcPtr;
  206.                 ioResult: OSErr;
  207.                 reserved: array[1..5] of LONGINT;
  208.                 filler1: INTEGER;
  209.                 sessRefNum: PPCSessRefNum;
  210.                 filler2: INTEGER;
  211.                 filler3: LONGINT;
  212.                 filler4: LONGINT;
  213.                 rejectInfo: LONGINT;
  214.             end;
  215.  
  216.         PPCWritePBPtr = ^PPCWritePBRec;
  217.         PPCWritePBRec = record
  218.                 qLink: Ptr;
  219.                 csCode: INTEGER;
  220.                 intUse: INTEGER;
  221.                 intUsePtr: Ptr;
  222.                 ioCompletion: PPCCompProcPtr;
  223.                 ioResult: OSErr;
  224.                 reserved: array[1..5] of LONGINT;
  225.                 filler1: INTEGER;
  226.                 sessRefNum: PPCSessRefNum;
  227.                 bufferLength: Size;
  228.                 actualLength: Size;
  229.                 bufferPtr: Ptr;
  230.                 more: BOOLEAN;
  231.                 filler2: SignedByte;
  232.                 userData: LONGINT;
  233.                 blockCreator: OSType;
  234.                 blockType: OSType;
  235.             end;
  236.  
  237.         PPCReadPBPtr = ^PPCReadPBRec;
  238.         PPCReadPBRec = record
  239.                 qLink: Ptr;
  240.                 csCode: INTEGER;
  241.                 intUse: INTEGER;
  242.                 intUsePtr: Ptr;
  243.                 ioCompletion: PPCCompProcPtr;
  244.                 ioResult: OSErr;
  245.                 reserved: array[1..5] of LONGINT;
  246.                 filler1: INTEGER;
  247.                 sessRefNum: PPCSessRefNum;
  248.                 bufferLength: Size;
  249.                 actualLength: Size;
  250.                 bufferPtr: Ptr;
  251.                 more: BOOLEAN;
  252.                 filler2: SignedByte;
  253.                 userData: LONGINT;
  254.                 blockCreator: OSType;
  255.                 blockType: OSType;
  256.             end;
  257.  
  258.         PPCEndPBPtr = ^PPCEndPBRec;
  259.         PPCEndPBRec = record
  260.                 qLink: Ptr;
  261.                 csCode: INTEGER;
  262.                 intUse: INTEGER;
  263.                 intUsePtr: Ptr;
  264.                 ioCompletion: PPCCompProcPtr;
  265.                 ioResult: OSErr;
  266.                 reserved: array[1..5] of LONGINT;
  267.                 filler1: INTEGER;
  268.                 sessRefNum: PPCSessRefNum;
  269.             end;
  270.  
  271.         PPCClosePBPtr = ^PPCClosePBRec;
  272.         PPCClosePBRec = record
  273.                 qLink: Ptr;
  274.                 csCode: INTEGER;
  275.                 intUse: INTEGER;
  276.                 intUsePtr: Ptr;
  277.                 ioCompletion: PPCCompProcPtr;
  278.                 ioResult: OSErr;
  279.                 reserved: array[1..5] of LONGINT;
  280.                 portRefNum: PPCPortRefNum;
  281.             end;
  282.  
  283.         IPCListPortsPBPtr = ^IPCListPortsPBRec;
  284.         IPCListPortsPBRec = record
  285.                 qLink: Ptr;
  286.                 csCode: INTEGER;
  287.                 intUse: INTEGER;
  288.                 intUsePtr: Ptr;
  289.                 ioCompletion: PPCCompProcPtr;
  290.                 ioResult: OSErr;
  291.                 reserved: array[1..5] of LONGINT;
  292.                 filler1: INTEGER;
  293.                 startIndex: INTEGER;
  294.                 requestCount: INTEGER;
  295.                 actualCount: INTEGER;
  296.                 portName: PPCPortPtr;
  297.                 locationName: LocationNamePtr;
  298.                 bufferPtr: PortInfoArrayPtr;
  299.             end;
  300.  
  301.         PPCParamBlockPtr = ^PPCParamBlockRec;
  302.         PPCParamBlockRec = record
  303.                 case Integer of
  304.                     0: (
  305.                             openParam: PPCOpenPBRec
  306.                     );
  307.                     1: (
  308.                             informParam: PPCInformPBRec
  309.                     );
  310.                     2: (
  311.                             startParam: PPCStartPBRec
  312.                     );
  313.                     3: (
  314.                             acceptParam: PPCAcceptPBRec
  315.                     );
  316.                     4: (
  317.                             rejectParam: PPCRejectPBRec
  318.                     );
  319.                     5: (
  320.                             writeParam: PPCWritePBRec
  321.                     );
  322.                     6: (
  323.                             readParam: PPCReadPBRec
  324.                     );
  325.                     7: (
  326.                             endParam: PPCEndPBRec
  327.                     );
  328.                     8: (
  329.                             closeParam: PPCClosePBRec
  330.                     );
  331.                     9: (
  332.                             listPortsParam: IPCListPortsPBRec
  333.                     );
  334.             end;
  335.  
  336.  
  337.  
  338. {  PPC Calling Conventions  }
  339.     function PPCInit: OSErr;
  340.     inline
  341.         $7000, $A0DD, $3E80;
  342.     function PPCOpen (pb: PPCOpenPBPtr; async: BOOLEAN): OSErr;
  343.     function PPCOpenSync (pb: PPCOpenPBPtr): OSErr;
  344.     inline
  345.         $205F, $7001, $A0DD, $3E80;
  346.     function PPCOpenAsync (pb: PPCOpenPBPtr): OSErr;
  347.     inline
  348.         $205F, $7001, $A4DD, $3E80;
  349.     function PPCInform (pb: PPCInformPBPtr; async: BOOLEAN): OSErr;
  350.     function PPCInformSync (pb: PPCInformPBPtr): OSErr;
  351.     inline
  352.         $205F, $7003, $A0DD, $3E80;
  353.     function PPCInformAsync (pb: PPCInformPBPtr): OSErr;
  354.     inline
  355.         $205F, $7003, $A4DD, $3E80;
  356.     function PPCStart (pb: PPCStartPBPtr; async: BOOLEAN): OSErr;
  357.     function PPCStartSync (pb: PPCStartPBPtr): OSErr;
  358.     inline
  359.         $205F, $7002, $A0DD, $3E80;
  360.     function PPCStartAsync (pb: PPCStartPBPtr): OSErr;
  361.     inline
  362.         $205F, $7002, $A4DD, $3E80;
  363.     function PPCAccept (pb: PPCAcceptPBPtr; async: BOOLEAN): OSErr;
  364.     function PPCAcceptSync (pb: PPCAcceptPBPtr): OSErr;
  365.     inline
  366.         $205F, $7004, $A0DD, $3E80;
  367.     function PPCAcceptAsync (pb: PPCAcceptPBPtr): OSErr;
  368.     inline
  369.         $205F, $7004, $A4DD, $3E80;
  370.     function PPCReject (pb: PPCRejectPBPtr; async: BOOLEAN): OSErr;
  371.     function PPCRejectSync (pb: PPCRejectPBPtr): OSErr;
  372.     inline
  373.         $205F, $7005, $A0DD, $3E80;
  374.     function PPCRejectAsync (pb: PPCRejectPBPtr): OSErr;
  375.     inline
  376.         $205F, $7005, $A4DD, $3E80;
  377.     function PPCWrite (pb: PPCWritePBPtr; async: BOOLEAN): OSErr;
  378.     function PPCWriteSync (pb: PPCWritePBPtr): OSErr;
  379.     inline
  380.         $205F, $7006, $A0DD, $3E80;
  381.     function PPCWriteAsync (pb: PPCWritePBPtr): OSErr;
  382.     inline
  383.         $205F, $7006, $A4DD, $3E80;
  384.     function PPCRead (pb: PPCReadPBPtr; async: BOOLEAN): OSErr;
  385.     function PPCReadSync (pb: PPCReadPBPtr): OSErr;
  386.     inline
  387.         $205F, $7007, $A0DD, $3E80;
  388.     function PPCReadAsync (pb: PPCReadPBPtr): OSErr;
  389.     inline
  390.         $205F, $7007, $A4DD, $3E80;
  391.     function PPCEnd (pb: PPCEndPBPtr; async: BOOLEAN): OSErr;
  392.     function PPCEndSync (pb: PPCEndPBPtr): OSErr;
  393.     inline
  394.         $205F, $7008, $A0DD, $3E80;
  395.     function PPCEndAsync (pb: PPCEndPBPtr): OSErr;
  396.     inline
  397.         $205F, $7008, $A4DD, $3E80;
  398.     function PPCClose (pb: PPCClosePBPtr; async: BOOLEAN): OSErr;
  399.     function PPCCloseSync (pb: PPCClosePBPtr): OSErr;
  400.     inline
  401.         $205F, $7009, $A0DD, $3E80;
  402.     function PPCCloseAsync (pb: PPCClosePBPtr): OSErr;
  403.     inline
  404.         $205F, $7009, $A4DD, $3E80;
  405.     function IPCListPorts (pb: IPCListPortsPBPtr; async: BOOLEAN): OSErr;
  406.     function IPCListPortsSync (pb: IPCListPortsPBPtr): OSErr;
  407.     inline
  408.         $205F, $700A, $A0DD, $3E80;
  409.     function IPCListPortsAsync (pb: IPCListPortsPBPtr): OSErr;
  410.     inline
  411.         $205F, $700A, $A4DD, $3E80;
  412.     function DeleteUserIdentity (userRef: LONGINT): OSErr;
  413.     function GetDefaultUser (var userRef: LONGINT; var userName: Str32): OSErr;
  414.     function StartSecureSession (pb: PPCStartPBPtr; var userName: Str32; useDefault: BOOLEAN; allowGuest: BOOLEAN; var guestSelected: BOOLEAN; prompt: Str255): OSErr;
  415.     function PPCBrowser (prompt: Str255; applListLabel: Str255; defaultSpecified: BOOLEAN; var theLocation: LocationNameRec; var thePortInfo: PortInfoRec; portFilter: PPCFilterProcPtr; theLocNBPType: Str32): OSErr;
  416.     inline
  417.         $303C, $0D00, $A82B;
  418.  
  419.  
  420.     { UsingPPCToolBox }
  421.  
  422.  
  423. implementation
  424. end.
  425.  
  426.